/*
 * @Author: dadadaXU 1413107032@qq.com
 * @Date: 2025-02-14 15:04:45
 * @LastEditors: dadadaXU 1413107032@qq.com
 * @LastEditTime: 2025-02-14 18:50:15
 * @FilePath: /thread-pool/ThreadPool/Thread.cpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// Thread.cpp : 线程类方法实现
//

#include "ThreadPool.h"

size_t Thread::generateId_ = 0;

Thread::Thread(ThreadFunc func) 
	: func_(func) 
	, threadId_(generateId_++)
{
	/* 创建线程执行线程函数 */
	std::thread t(func_, threadId_);
	t.detach(); // 与主线程分离
}

size_t Thread::getThreadId() const
{
	return threadId_;
}